{% extends "PATHomeBundle::base.html.twig" %}
{% block title %}{{ parent() }} Wishlist - Index{% endblock %}
{% block body %}
<div id="wishlist">
    <h1>Favoris</h1>
    <div id="togepi_wishlists"></div>
    {% if wishlistList.count()>0 %}
    <div>
        <table class="table_wishlist">
            <tr>
                <th>Nom</th>
                <th>Nb d'articles</th>
                <th>Ajouter au panier</th>
                <th>Supprimer</th>
            </tr>
            {% for wishlist in wishlistList %}
            <tr>
                <td><a href="{{ path('pat_wishlist_display', { 'id': wishlist.id }) }}">{{ wishlist.name }}</a></td>
                <td style="text-align: right;">{{ wishlist.products.count() }}</td>
                <td><a href="{{ path('pat_cart_add_wishlist', { 'wishlistId': wishlist.id }) }}">Ajouter</a></td>
                <td><a href="{{ path('pat_wishlist_delete', { 'id': wishlist.id }) }}">Supprimer</a></td>
            </tr>
            {% endfor %}
        </table>
    </div>
    {% endif %}
    <input type="button" value="Ajouter une liste de souhaits" class="generic_link" onclick="document.getElementById('dialog_add_wishlist').style.display='block';document.getElementById('fade').style.display='block'"/>
    <div id="dialog_add_wishlist">
        <form method="post" {{ form_enctype(form) }}>
        <fieldset>
            {{ form_widget(form) }}
        </fieldset>
            <input class="generic_link" type="submit" class="btn btn-primary" />
            <input type="button" value="Annuler" onclick = "document.getElementById('dialog_add_wishlist').style.display='none';document.getElementById('fade').style.display='none'"/>
        </form>
    </div>
    <div id="fade" class="black_overlay"></div>	
</div>
{% endblock %}